@extends('admin.app')

@section('breadcrumb')
<div class="bg-light lter b-b wrapper-md">
  <ol class="breadcrumb bg-light lter m-n no-padder">
    <li><a href="{{ admin_action('HomeController@index') }}">主页</a></li>
    <li>网站管理</li>
    <li><a href="{{ admin_action('Web\FriendlyLinksController@index') }}">友情链接管理</a></li>
    <li class="active">新增友情链接</li>
  </ol>
</div>
@endsection

@section('content')
  <div class="panel panel-default">
    <div class="panel-heading font-bold">
      友情链接表单
    </div>
    <div class="panel-body">
      <form enctype="multipart/form-data" class="form-horizontal form-validation" action="{{ admin_action('Web\FriendlyLinksController@store') }}" method="post">
        {{ csrf_field() }}
        <div class="form-group">
          <label class="col-lg-2 control-label">名称*</label>
          <div class="col-lg-10">
            <input type="text" class="form-control" name="name" value="{{ old('name') }}" placeholder="请输入名称" data-rule-required="true" data-rule-maxlength="50">
          </div>
        </div>

        <div class="line line-dashed b-b line-lg"></div>
        <div class="form-group">
          <label class="col-lg-2 control-label">友情链接*</label>
          <div class="col-lg-10">
            <input type="text" class="form-control" name="link" value="{{ old('link') }}" placeholder="请输入链接URl" data-rule-required="true" data-rule-maxlength="100">
          </div>
        </div>
        <div class="line line-dashed b-b line-lg"></div>
        <div class="form-group">
          <label class="col-lg-2 control-label">链接类型*</label>
          <div class="col-lg-10">
            <select class="form-control select2" name="link_type" data-rule-required="true">
              <option value="">请选择链接类型</option>
              @foreach($friendly_link_types as $friend_link_type)
                <option value="{{ $friend_link_type->code }}">{{ $friend_link_type->name }}</option>
              @endforeach
            </select>
          </div>
        </div>
        <div class="line line-dashed b-b line-lg"></div>
        <div class="form-group">
          <label class="col-lg-2 control-label">链接图片*</label>
          <div class="col-lg-10">
            <input type="file" name="image" value="{{ old('image') }}" data-fileinput-image/>
          </div>
        </div>
          <div class="line line-dashed b-b line-lg"></div>
          <div class="form-group">
              <label class="col-lg-2 control-label">排序*</label>
              <div class="col-lg-10">
                  <input type="text" class="form-control" name="sort" value="{{ old('sort')??0 }}" placeholder="请输入排序" data-rule-required="true" data-rule-digits="true">
              </div>
          </div>
          <div class="line line-dashed b-b line-lg"></div>
          <div class="form-group">
              <label class="col-lg-2 control-label">备注</label>
              <div class="col-lg-10">
                  <textarea name="description" placeholder="请填写描述信息" class="form-control"  data-rule-maxlength="100"></textarea>
              </div>
          </div>

        <div class="line line-dashed b-b line-lg"></div>
        <div class="form-group">
          <div class="col-lg-4 col-lg-offset-2">
            <a href="{{ admin_action('Web\FriendlyLinksController@index') }}" class="btn btn-default">返&nbsp;回</a>
            <button type="submit" class="btn btn-primary">保&nbsp;存</button>
          </div>
        </div>
      </form>
    </div>
  </div>
@endsection